package com.kdl.webconfig.controller;


import com.kdl.webconfig.business.NewsDetailBusiness;
import com.kdl.webconfig.vo.BaseRespVO;
import com.kdl.webconfig.vo.config.NewsDetailVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 新闻详情表 前端控制器
 * </p>
 *
 * @author wcj
 * @since 2022-09-14
 */
@RestController
@RequestMapping("/webconfig/newsDetail")
@Api(value = "新闻详情管理接口", tags = {"新闻详情配置"})
public class NewsDetailController {

    @Autowired
    private NewsDetailBusiness newsDetailBusiness;

    @GetMapping("/show/{newsId}")
    @ApiOperation(value = "详情查看")
    public BaseRespVO<NewsDetailVO> show(@PathVariable Integer newsId){
        NewsDetailVO detail = newsDetailBusiness.detail(newsId);
        return BaseRespVO.success(detail);
    }

    @PostMapping("/saveOrUpdate")
    @ApiOperation(value = "详情保存")
    public BaseRespVO<Boolean> saveOrUpdate(@RequestBody NewsDetailVO newsDetailVO){
        Boolean b = newsDetailBusiness.saveOrUpdate(newsDetailVO);
        return BaseRespVO.success(b);
    }
}

